const { Model , DataTypes } = require('sequelize');

const sequelize = require('../config/sequelize');

class User extends Model {
}

const attributes = {
    id: {
        type: DataTypes.INTEGER,
        autoIncrement: true,
        primaryKey: true,
        field: `id`
    },
    account: DataTypes.STRING,
    email: DataTypes.STRING,
    tel: DataTypes.STRING,
    password: {
        type: DataTypes.STRING
    },
    salt: DataTypes.STRING
}

const options = {
    tableName: 't_users',
    sequelize , /* `sequelize` 是 `sequelize: sequelize` 的简写  */
    /* 指定 timestamps 为 false 表示在数据库表中不使用 createAt 和 updateAt 字段 */
    timestamps: false
}

User.init( attributes , options );

module.exports = User ;